﻿using UnityEngine;
using System.Collections;

namespace UI
{
    public class UIUnionFightOrderPage : MonoBehaviour
    {
        public GameObject pref;
        public GameObject mask;
        public UIScrollView scrollView;
        public SimpleGrid simpleGrid;
        void Start()
        {
            Init();
        }

        void Init()
        {
            foreach(var item in simpleGrid.childs)
            {
                Destroy(item);
            }
            simpleGrid.childs.Clear();

            var list = Dict.Blo.DictUnionFightTalkBlo.GetAll();
            pref.SetActive(true);
            for (int i = 0; i < list.Count; i++)
            {
                GameObject obj = Instantiate(pref);
                simpleGrid.AddChild(obj);
                var script = obj.GetComponent<UIUnionFightOrderItem>();
                script.SetItem(list[i].title, list[i].content);
            }
            pref.SetActive(false);
            scrollView.ResetPosition();
        }
    }
}

